package com.zw.yzk.kabu.data.repository;


import com.zw.yzk.kabu.data.network.ServiceGenerator;
import com.zw.yzk.kabu.data.network.entity.ActiveRankEntity;
import com.zw.yzk.kabu.data.network.service.ActiveRankService;
import com.zw.yzk.kabu.data.network.task.ActiveRankTask;
import com.zw.yzk.kabu.data.network.task.Task;

import javax.inject.Inject;

import rx.Observable;
import rx.functions.Func1;

/**
 * Created by zhanwei on 2017/1/4.
 */

public class ActiveRankRepository extends CommonRepository {

    @Inject
    public ActiveRankRepository() {
    }

    @Override
    protected Observable connectServer(Task task) {
        ActiveRankService service = ServiceGenerator.createService(ActiveRankService.class);
        ActiveRankTask uTask = (ActiveRankTask) task;
        return service.getAcive(uTask.userId, uTask.accessToken, uTask.activeId, uTask.key, uTask.index, uTask.size);
    }

    @Override
    protected Func1<ActiveRankEntity, Observable> getServerData() {
        return new Func1<ActiveRankEntity, Observable>() {
            @Override
            public Observable call(ActiveRankEntity entity) {
                return Observable.just(entity);
            }
        };
    }

}
